#pragma once

#include "dfize.h"
#include "STilePosition.h"

struct SResource;
struct SBasicMaterial;
class CBlockSceneNode;
class CTriangleSelector;

enum E_TILE_SIZE_TYPE
{
	ETST_EMPTY = 0,
	ETST_WALL,
	ETST_FLOOR,
	ETST_DYNAMIC
};

class CTile
{
public:
	CTile(CBlockSceneNode *block);

	~CTile();

	const matrix4 getAbsoluteTransformation() const;
	const matrix4 getRelativeTransformation() const;

	ITriangleSelector* getTriangleSelector();

	u8 getTileSizeType();
	void setTileType(u16 tiletype);
	void setMaterialIndex(u32 materialindex);

	const DFHack::TileMaterial getTileMaterial() const;
	const DFHack::TileVariant getTileVariant() const;
	const DFHack::TileClass getTileClass() const;

	const vector3df getPositionf() const;
	const STilePosition getPosition() const;
	const vector3di getGlobalPosition() const;

	void updateTile();

	SBasicMaterial* getMaterial() const;
	void setMaterial(SBasicMaterial *m) { Material = m; }

//	vector3df RelativeTranslation, RelativeRotation, RelativeScale;
	STilePosition Position;
	aabbox3df BoundingBox, TransformedBoundingBox;
	SResource *Resource;
	u16 TileType;
	SBasicMaterial *Material;
	CBlockSceneNode *Block;
	bool Visible, Lighting;

private:
	CTriangleSelector *TriangleSelector;
};